package com.sunfeng.n4.crossoutput;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.locks.LockSupport;

/**
 * @author sunfeng
 * @date 2021/03/30 14:45
 **/

@Slf4j(topic = "c.ParkUnpark")
public class ParkUnpark {
    public static void main(String[] args) {

        Thread thread = new Thread(() -> {
            LockSupport.park();
            log.debug("1");

        }, "t1");

        thread.start();

        new Thread(()->{

            log.debug("2");
            LockSupport.unpark(thread);
        },"t2").start();

    }
}
